VERSION 5.00
Begin VB.Form frmReport 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Report"
   ClientHeight    =   3840
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8370
   Icon            =   "frmReport.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3840
   ScaleWidth      =   8370
   Begin VB.PictureBox Picture1 
      BorderStyle     =   0  'None
      Height          =   855
      Left            =   120
      Picture         =   "frmReport.frx":1CCA
      ScaleHeight     =   855
      ScaleWidth      =   855
      TabIndex        =   14
      Top             =   120
      Width           =   855
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Close"
      Height          =   495
      Left            =   4680
      TabIndex        =   12
      Top             =   3120
      Width           =   2535
   End
   Begin VB.Frame Frame1 
      Height          =   2895
      Left            =   1200
      TabIndex        =   1
      Top             =   0
      Width           =   7095
      Begin VB.CommandButton cmdGindo 
         Caption         =   "GINDO CASH FLOW"
         Height          =   375
         Left            =   3480
         TabIndex        =   13
         Top             =   840
         Width           =   2535
      End
      Begin VB.CommandButton Command1 
         Caption         =   "BUDGETSUMMARY"
         Height          =   375
         Left            =   3480
         TabIndex        =   8
         Top             =   1320
         Width           =   2535
      End
      Begin VB.CommandButton Command2 
         Caption         =   "GINDO BUDGET SUMMARY"
         Height          =   375
         Left            =   3480
         TabIndex        =   7
         Top             =   1800
         Width           =   2535
      End
      Begin VB.CommandButton Command3 
         Caption         =   "CASH FLOW REPORT"
         Height          =   375
         Left            =   3480
         TabIndex        =   6
         Top             =   360
         Width           =   2535
      End
      Begin VB.CommandButton Command4 
         Caption         =   "EXPENDITURE"
         Height          =   375
         Left            =   3480
         TabIndex        =   5
         Top             =   2280
         Width           =   2535
      End
      Begin VB.ComboBox cboOffice 
         Height          =   315
         Left            =   1320
         TabIndex        =   4
         Top             =   480
         Width           =   1335
      End
      Begin VB.ComboBox cboMonth 
         Height          =   315
         Left            =   1320
         TabIndex        =   3
         Top             =   840
         Width           =   1335
      End
      Begin VB.ComboBox cboYear 
         Height          =   315
         Left            =   1320
         TabIndex        =   2
         Top             =   1200
         Width           =   1335
      End
      Begin VB.Label Label1 
         Caption         =   "Office"
         Height          =   255
         Left            =   480
         TabIndex        =   11
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "Month"
         Height          =   255
         Left            =   480
         TabIndex        =   10
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "Year"
         Height          =   255
         Left            =   480
         TabIndex        =   9
         Top             =   1200
         Width           =   1215
      End
   End
   Begin VB.CommandButton Command5 
      Caption         =   "&Close"
      Height          =   615
      Left            =   5520
      TabIndex        =   0
      Top             =   8160
      Width           =   3855
   End
End
Attribute VB_Name = "frmReport"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdGindo_Click()
Dim previousMMYY As String
Dim mm, yy As String
mm = cboMonth.Text
yy = Right(cboYear.Text, 2)
If Val(mm) = 1 Then
    previousMMYY = "120" & Val(yy) - 1
ElseIf Val(mm) - 1 < 10 Then
    previousMMYY = "0" & Val(mm) - 1 & yy
ElseIf Val(mm) - 1 >= 10 Then
    previousMMYY = Val(mm) - 1 & yy
End If

If Not isExistBalance(Left(previousMMYY, 2), Right(previousMMYY, 2), strOffice) Then
    If MsgBox("The balance of previous month does not exist. Do you want to update the balance manually?(Y/N)", vbQuestion + vbYesNo + vbDefaultButton2, "Update Balance?") = vbNo Then
        Exit Sub
    Else
        frmBalance.Show
        frmBalance.cboBMonth.Text = Left(previousMMYY, 2)
        frmBalance.cboBYear.Text = "20" & Right(previousMMYY, 2)
        Exit Sub
    End If
End If

Call funCASHFLOWREPORT(cboMonth.Text, Right(cboYear.Text, 2), 1)
End Sub

Private Sub Command1_Click()
Call funBUDGETSUMMARY(Right(cboYear.Text, 2))
End Sub

Private Sub Command2_Click()
Call fcnGINDOBUDGETSUMMARY(Right(cboYear.Text, 2))
End Sub

Private Sub Command3_Click()
Dim previousMMYY As String
Dim mm, yy As String
mm = cboMonth.Text
yy = Right(cboYear.Text, 2)
If Val(mm) = 1 Then
    previousMMYY = "120" & Val(yy) - 1
ElseIf Val(mm) - 1 < 10 Then
    previousMMYY = "0" & Val(mm) - 1 & yy
ElseIf Val(mm) - 1 >= 10 Then
    previousMMYY = Val(mm) - 1 & yy
End If

If Not isExistBalance(Left(previousMMYY, 2), Right(previousMMYY, 2), strOffice) Then
    If MsgBox("The balance of previous month does not exist. Do you want to update the balance manually?(Y/N)", vbQuestion + vbYesNo + vbDefaultButton2, "Update Balance?") = vbNo Then
        Exit Sub
    Else
        frmBalance.Show
        frmBalance.cboBMonth.Text = Left(previousMMYY, 2)
        frmBalance.cboBYear.Text = "20" & Right(previousMMYY, 2)
        Exit Sub
    End If
End If
Call funCASHFLOWREPORT(cboMonth.Text, Right(cboYear.Text, 2), 0)
End Sub

Private Sub Command4_Click()
Call funExpenditureREPORT(cboMonth.Text, Right(cboYear.Text, 2), cboOffice.Text)

End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Command6_Click()
Unload Me
End Sub



Private Sub Form_Load()
Me.Top = Screen.Height / 2 - (Me.Height / 1.5)
    Me.Left = Screen.Width / 2 - (Me.Width / 2)
Call KetNoi
If strOffice = "SGN" Then
    cboOffice.AddItem "GHAN"
    cboOffice.AddItem "GSGN"
    cboOffice.AddItem "GDAD"
    cboOffice.AddItem "GKH"
    cboOffice.AddItem "GLA"
    cboOffice.ListIndex = 1
    cboOffice.Enabled = False
    cmdGindo.Enabled = True
Else
    cboOffice.AddItem "G" & strOffice
    cboOffice.ListIndex = 0
    cboOffice.Enabled = False
    cmdGindo.Enabled = False
End If
For i = 1 To 9
    cboMonth.AddItem "0" & i
Next i
For i = 10 To 12
    cboMonth.AddItem i
Next i
If Month(Now()) < 10 Then
    cboMonth.Text = "0" & Month(Now())
Else
    cboMonth.Text = Month(Now())
End If
For i = 7 To Val(Right(Year(Now()), 2))
    cboYear.AddItem "200" & i
Next i
cboYear.Text = Year(Now())
End Sub
